<?php 
/**
 * Joomla! 1.5 component ArticleCashRewards
 *
 * @version $Id: default.php 2009-05-10 01:47:01 svn $
 * @author Maverick
 * @package Joomla
 * @subpackage components.views.tmpl
 * @link http://joomladev.boddunan.com
 * @license GNU/GPL
 *
 * Review and approve the articles and assign points and cash rewards.
 * Users can see their articles and the points/cash rewards assigned in the front-end module.
 */

// no direct access
defined('_JEXEC') or die('Restricted access');
include('tabs.php');
if($this->acr_config[CONFIG_ENABLE_WEBLINKS] == '1'){
?>
<div class="current"><dd style="display: block;">
<table border="0" cellpadding="5" cellspacing="0" width="100%">
    <?php if($ruser == null || $user->id==$ruser){?>
    <tr>
        <td>
            <form action="index.php?option=com_articlecashrewards" method="post" name="adminForm">
            <table class="noshow">
                <tr>
                    <td>
                        <table class="acrtable">
                            <tr>
                                <td class="key">
                                    <span><?php echo JText::_('WEBLINK_LINK');?></span>
                                </td>
                                <td>
                                    <input type="text" id="weblink_link" name="weblink_link" size="80" class="inputbox">
                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    <span><?php echo JText::_('WEBLINK_DESCRIPTION');?></span>
                                </td>
                                <td>
                                    <input type="text" id="weblink_desc" name="weblink_desc" size="80" class="inputbox">
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="submit" class="button" value="<?php echo JText::_('LABEL_SUBMIT')?>">
                    </td>
                </tr>
            </table>
            <input type="hidden" name="option" value="com_articlecashrewards" />
            <input type="hidden" name="controller" value="mypage" />
            <input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
            <input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
            <input type="hidden" name="task" value="submitweblink" />
            <?php echo JHTML::_( 'form.token' ); ?>
            </form>
        </td>
    </tr>
    <?php } ?>
    <?php if($this->weblinks){ ?>
    <tr>
        <td>
            <table border="0" cellpadding="5" cellspacing="0" width="100%">
                <thead>
                    <tr>
                        <th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="2%"><div align="center">#</div></th>
                        <th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="40%"><div align="left"><?php echo JText::_('LABEL_WEBLINK'); ?></div></th>
                        <th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="20%"><div align="left"><?php echo JText::_('LABEL_DATE_SUBMITTED'); ?></div></th>
                        <th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="18%"><div align="left"><?php echo JText::_('LABEL_DESCRIPTION'); ?></div></th>
                        <th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="5%"><div align="left"><?php echo JText::_('LABEL_STATUS'); ?></div></th>
                        <th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="15%"><div align="left"><?php echo JText::_('LABEL_REMARKS'); ?></div></th>
                    </tr>
                </thead>
                <tbody>
                <?php
                $i = 0;
                $k = 0;
                foreach ($this->weblinks as $row) {
                ?>
                    <tr>
            			<td class="sectiontableentry<?php echo $k; ?>" width="10%"><div align="center"><?php echo $this->pagination->getRowOffset( $i); ?></div></td>
                        <td align="left">
                            <?php echo $row->value; ?>
                        </td>
                        <td align="left">
                            <?php echo $row->date_submitted; ?>
                        </td>
                        <td align="left">
                            <?php echo $row->description; ?>
                        </td>
                        <td align="left">
                            <?php
                                if($row->status == 1){
                                    $img = 'published.png';
                                    $alt = 'APPROVED';
                                }else if($row->status == 2){
                                    $img = 'rejected.png';
                                    $alt = 'REJECTED';
                                }else{
                                    $img = 'pending.png';
                                    $alt = 'PENDING';
                                }
                             ?>
                            <img src="components/com_articlecashrewards/assets/images/<?php echo $img; ?>" border="0" title="<?php echo JText::_( $alt ); ?>" alt="<?php echo JText::_( $alt ); ?>" />
                        </td>
                        <td align="left">
                            <?php echo $row->remarks; ?>
                        </td>
                    </tr>
                <?php
                    $i++;
                    $k = 1 - $k;
                 }
                ?>
                </tbody>
                <tfoot>
                    <tr>
                        <form action="index.php?option=com_articlecashrewards" method="post" name="adminForm">
                            <td colspan="6">
                            <?php
                                echo $this->pagination->getPagesLinks();
                                echo $this->pagination->getPagesCounter();
                            ?>
                            <input type="hidden" name="option" value="com_articlecashrewards" />
                            <input type="hidden" name="controller" value="mypage" />
                            <input type="hidden" name="task" value="weblinks" />
                            <input type="hidden" name="boxchecked" value="0" />
                            <?php echo JHTML::_( 'form.token' ); ?>
                            </td>
                        </form>
                    </tr>
                </tfoot>
            </table>
        </td>
    </tr>
    <?php
    }else{
        echo '<tr><td>' . JText::_('MSG_NO_WEBLINKS') .'</td></tr>';
    }
    ?>
    <tr>
        <td align="center" nowrap="nowrap">
            <div style="font-size: 9px;;">
            Article Cash Rewards powered by <a href="http://boddunan.com">boddunan.com</a>
            </div>
        </td>
    </tr>
</table>
</dd></div>
<?php
}
?>